package com.atguigu.lease.web.admin.mapper;

import com.atguigu.lease.model.entity.LabelInfo;
import com.atguigu.lease.model.enums.ItemType;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
* @author liubo
* @description 针对表【label_info(标签信息表)】的数据库操作Mapper
* @createDate 2023-07-24 15:48:00
* @Entity com.atguigu.lease.model.LabelInfo
*/
public interface LabelInfoMapper extends BaseMapper<LabelInfo> {

    /**
     * 获取标签列表
     * @param id
     * @return
     */
    @Select("select id, type, name from label_info where label_info.is_deleted = 0 and id in " +
            "(select apartment_label.label_id from apartment_label where apartment_label.is_deleted = 0 and  apartment_id = #{id})")
    List<LabelInfo> selectListByApartmentId(Long id);

    /**
     * 根据房间id获取标签列表
     * @param id
     * @return
     */
    @Select("select id,type,name from label_info where is_deleted = 0 and id in " +
            "(select label_id from room_label where is_deleted = 0 and room_id = #{id})")
    List<LabelInfo> selectListByRoomId(Long id);
}




